import request from '@/utils/request'

const api = {
  merchantQuery: '/merchant/query',
  merchantApplyQuery: '/merchant/user/apply/query',
  merchantUserQuery: '/merchant/user/query',
  merchantBusApplyQuery: '/merchant/business/apply/query',
  merchantDtl: '/merchant/detail',
  updateMerchant: '/merchant/modify',
  editMerchantStatus: '/merchant/modify/status',
  authorizeTemp: '/merchant/contractTemplate/add',
  delTemp: '/merchant/contractTemplate/remove',
  merchantAudit: '/merchant/user/apply/audit',
  addMerchant: '/merchant/add',
  mechantUserDtl: '/merchant/user/detail',
  addMechantUser: '/merchant/user/add',
  updateMechantUser: '/merchant/user/modify',
  editMerchantUserStatus: '/merchant/user/modify/status',
  delMerchantUser: '/merchant/user/remove',
  handleMark: '/merchant/business/apply/handle'
}

/**
 * merchantQuery func
 * parameter: {
 *     pageNum: '',
 *     pageSize: '',
 *     status: '',
 *     merchantKeyword:'',
 *     custMagerKeyword:'',
 *     repaymentPlanId:'',
 *     creditLevel:'',
 * }
 * @param parameter
 * @returns {*}
 */
export function getMerchantList (parameter) {
  return request({
    url: api.merchantQuery,
    method: 'post',
    data: parameter
  })
}

/**
 * merchantApplyQuery func
 * parameter: {
 *     pageNum: '',
 *     pageSize: '',
 *     status: '',
 *     mobile:'',
 *     userName:'',
 *     startCreateTime:'',
 *     endCreateTime:'',
 * }
 * @param parameter
 * @returns {*}
 */
export function getMerchantApplyList (parameter) {
  return request({
    url: api.merchantApplyQuery,
    method: 'post',
    data: parameter
  })
}

/**
 * merchantUserQuery func
 * parameter: {
 *     pageNum: '',
 *     pageSize: '',
 *     templateKeyword: '',
 *     userKeyword: '',
 *     merchantKeyword'',
 *     repaymentStatus:'',
 *     capitalContractStatus:'',
 *     merchantContractNo:'',
 *     serviceFeePayStatus:'',
 *     startCreateTime:'',
 *     endCreateTime:'',
 *     endReceiveHandleResult:'',
 *     startSignCompleteTime:'',
 *     endSignCompleteTime:''
 * }
 * @param parameter
 * @returns {*}
 */
export function getMerchantUserList (parameter) {
  return request({
    url: api.merchantUserQuery,
    method: 'post',
    data: parameter
  })
}

/**
 * merchantBusApplyQuery func
 * parameter: {
 *     pageNum: '',
 *     pageSize: '',
 *     status: '',
 *     mobile:'',
 *     userName:'',
 *     startCreateTime:'',
 *     endCreateTime:'',
 * }
 * @param parameter
 * @returns {*}
 */
export function getMerchantBusApplyList (parameter) {
  return request({
    url: api.merchantBusApplyQuery,
    method: 'post',
    data: parameter
  })
}

/**
 * merchantDtl func
 * parameter: {
 *     merchantId: '',
 * }
 * @param parameter
 * @returns {*}
 */
export function getMerchantDtl (parameter) {
  return request({
    url: api.merchantDtl,
    method: 'post',
    data: parameter
  })
}

/**
 * updateMerchant func
 * parameter: {
 *     merchantId: '',
 *     merchantNo: '',
 *     merchantName: '',
 *     contactName:'',
 *     contactMobile: '',
 *     custMagerId: '',
 *     repaymentPlanId: '',
 *     pics:'',
 *     creditLevel:'',
 * }
 * @param parameter
 * @returns {*}
 */
export function updateMerchant (parameter) {
  return request({
    url: api.updateMerchant,
    method: 'post',
    data: parameter
  })
}

/**
 * editMerchantStatus func
 * parameter: {
 *     status: '',
 *     freezingReason:'',
 *     merchantList:[{merchantId:''}]
 * }
 * @param parameter
 * @returns {*}
 */
export function editMerchantStatus (parameter) {
  return request({
    url: api.editMerchantStatus,
    method: 'post',
    data: parameter
  })
}

/**
 * authorizeTemp func
 * parameter: {
 *     merchantId: '',
 *     templateNo:'',
 *     contractNums:''
 * }
 * @param parameter
 * @returns {*}
 */
export function authorizeTemp (parameter) {
  return request({
    url: api.authorizeTemp,
    method: 'post',
    data: parameter
  })
}

/**
 * delTemp func
 * parameter: {
 *     merchantId: '',
 *     templateNo: '',
 * }
 * @param parameter
 * @returns {*}
 */
export function delTemp (parameter) {
  return request({
    url: api.delTemp,
    method: 'post',
    data: parameter
  })
}

/**
 * merchantAudit func
 * parameter: {
 *     applyId: '',
 *     status:'',
 *     merchantId: '',
 *     userJob:'',
 *     auditReason:'',
 * }
 * @param parameter
 * @returns {*}
 */
export function merchantAudit (parameter) {
  return request({
    url: api.merchantAudit,
    method: 'post',
    data: parameter
  })
}

/**
 * addMerchant func
 * parameter: {
 *     merchantNo: '',
 *     merchantName:'',
 *     contactName: '',
 *     contactMobile:'',
 *     custMagerId:'',
 *     repaymentPlanId:'',
 *     pics: '',
 *     creditLevel:'',
 *     applyId:'',
 * }
 * @param parameter
 * @returns {*}
 */
export function addMerchant (parameter) {
  console.log(parameter)
  return request({
    url: api.addMerchant,
    method: 'post',
    data: parameter
  })
}

/**
 * mechantUserDtl func
 * parameter: {
 *     userId: ''
 * }
 * @param parameter
 * @returns {*}
 */
export function getMechantUserDtl (parameter) {
  return request({
    url: api.mechantUserDtl,
    method: 'post',
    data: parameter
  })
}

/**
 * addMechantUser func
 * parameter: {
 *     merchantId: '',
 *     userName: '',
 *     mobile:'',
 *     userJob:''
 * }
 * @param parameter
 * @returns {*}
 */
export function addMechantUser (parameter) {
  return request({
    url: api.addMechantUser,
    method: 'post',
    data: parameter
  })
}

/**
 * updateMechantUser func
 * parameter: {
 *     userId: '',
 *     userName: '',
 *     mobile:'',
 *     userJob:''
 * }
 * @param parameter
 * @returns {*}
 */
export function updateMechantUser (parameter) {
  return request({
    url: api.updateMechantUser,
    method: 'post',
    data: parameter
  })
}

/**
 * editMerchantUserStatus func
 * parameter: {
 *     status: '',
 *     freezingReason: '',
 *     userList:[{userId:''}]
 * }
 * @param parameter
 * @returns {*}
 */
export function editMerchantUserStatus (parameter) {
  return request({
    url: api.editMerchantUserStatus,
    method: 'post',
    data: parameter
  })
}

/**
 * delMerchantUser func
 * parameter: {
 *    userList:[{userId:''}]
 * }
 * @param parameter
 * @returns {*}
 */
export function delMerchantUser (parameter) {
  return request({
    url: api.delMerchantUser,
    method: 'post',
    data: parameter
  })
}

/**
 * handleMark func
 * parameter: {
 *    handleMark:'',
 *    handleResult:''
 * }
 * @param parameter
 * @returns {*}
 */
 export function handleMark (parameter) {
  return request({
    url: api.handleMark,
    method: 'post',
    data: parameter
  })
}
